<template>
	<div class="one_cart_item_container">
		<div>
			<!-- 		  <template #left>
		    <van-button square type="primary" text="选择" />
		  </template> -->
			<!-- <van-cell :border="false" title="单元格" value="内容" /> -->
			<!-- <div>11111111111</div> -->
			<!-- <div class="cart_item_img"> -->
			<slot name="one_cart_item_img"></slot>
			<!-- </div> -->
			<div class="one_cart_item_desc">
				<slot name="one_cart_item_desc"></slot>
			</div>
			<div class="one_cart_item_price">
				<slot name="one_cart_item_price"></slot>
			</div>
			<div class="one_cart_item_right">
				<slot name="one_cart_item_right"></slot>
			</div>
			
			<div class="one_cart_item_right_del">
				<slot name="one_cart_item_right_del"></slot>
			</div>
			<!-- <img src="../../assets/top_icon.png" class="container_top_icon"/> -->
			<!-- <template #right>
				<van-button square type="danger" text="删除" />
			</template> -->
			<!-- <div class="order_one_cart_item_del_id"  v-show="true"><slot name="order_one_cart_item_del_id"></slot></div> -->
		</div>
	</div>
</template>

<script>
	import {
		showConfirmDialog
	} from 'vant';

	export default {
		setup() {
			// position 为关闭时点击的位置
			const beforeClose = (position, instance) => {
				console.log("进入删除数据模块")
				switch (position) {
					case 'left':
					case 'cell':
					case 'outside':
						return true;
					case 'right':
						return new Promise((resolve) => {
							showConfirmDialog({
									title: '确定删除吗？',
								})
								.then(() => {
									// resolve(true)
									console.log("xxx111x is");
									console.log("position is:" + position)
									instance.close();
									

								})
								.catch(() => resolve(false));
						});
						break;
				}
			};

			return {
				beforeClose
			};
		},
		methods: {
			// position 为关闭时点击的位置
			// instance 为对应的 SwipeCell 实例
			// beforeClose({ position, instance }) {
			//   switch (position) {
			//     case 'left':
			//     case 'cell':
			//     case 'outside':
			//       instance.close();
			//       break;
			//     case 'right':
			//       Dialog.confirm({
			//         message: '确定删除吗？'
			//       }).then(() => {
			//         instance.close();
			//       });
			//       break;
			//   }
			// }
		}
	};
</script>

<style scoped lang="less">
	/* 	.cart_item_img {
		top: 10px;
		left: 10px;
		width: 100px;
		height: 100px;
	}
	 */
	/* 	.cart_item_desc {
		left: 10px;
		width: 20px;
	}
	
	.cart_item_price {
		left: 10px;
		width: 20px;
	} */

	/* 	.cart_item_right {
		left: 10px;
		width: 20px;
	} */
	// :deep(.van-swipe-cell__wrapper) {
	// 	height: 100px;
	// }
</style>